defmodule EthereumJSONRPC.Filecoin do
  @moduledoc """
  Ethereum JSONRPC methods that are only supported by Filecoin.

  Sample response from FEVM `trace_block` method:

  curl -s -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"trace_block","params":["0x37E611"],"id":1,"jsonrpc":"2.0"}' \
  http://...:1234/rpc/v1 | jq -r .result
  [
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000021cc23",
      "to": "0xff000000000000000000000000000000001a34e5",
      "gas": "0x1891a7d",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0960ee115a7a4b6f2fd36a83da26c608d49e4160a3737655d0f637b81be81b018539809d35519b0b75ca06304b3b4d40c810e50b954e82c5119a8b4a64c3e762a7ae8a2d465d1cd5bf096c87c56ab0da879568378e5a2368c902eea9898cf1e2a1974ddb479ec6257b69aca7734d3b3e1e70428c77f9e528ffcb3dc3f050f0193c2cc005927a765c39a4931d67fb29aaba6e99f2c7d2566b98fdbf30d6e15a2bbd63b8fa059cfad231ccba1d8964542b50419eaad4bc442d3a1dc1f41941944c11a0037e5f45820d41114bb6abbf966c2528f5705447a53ee37b7055cd4478503ea5eaf1fe165c60000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x14696c1",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0xf37d8b8bf67df3ddaa264e22322d2b092e390ed33f1ab14c8a136b2767979254",
    "transactionPosition": 1
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x4482939",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182064081820d58c097ea8a30fc450e9f5370bdfd0a5fbadb528b137c52ba4b22cbdd91cd1b312707556314b8400967aeb858c2dc8d68d7eb8b76960a414bf41ad73831bd6500d3ff06d8f8b1af823e1d2f5f9803d5402c4038b87a4c77803589bc0a9b982ae90d4a02381370e0f4aa4f3145acaa5a99854ba6bffbf02778c2f7ed66b141da1aab9fac560a184662c5e47e2764e9c4221ff982c750a5aafb97968a0348331218b069e0f754e62341ed115f2f05a5c86def9ce1dff851918cfa69095611517d99f27e1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x3c65351",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x83ca0e80894733453286b03e4caa9b1f3d4f4e14e52e583a46c99f3504a10e78",
    "transactionPosition": 2
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x42d9aa2",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182074081820d58c08a894f371e2e6808da865600757651857a086c1b186f6b8b7e28ad730a0d4febc506609da7629fd39966a7d44ca8d40c8203bf0625b54f4dc6a5598fc5154a0498e940820d49b5c19fa1211766feac30d08f2f886be3e3e677d6da346b9eb92a0a89aaeb839f00ad85631801e18397c1390a3847d3b9fd04f091f55ba561ebe401d6d66baa19e41fb7aa030590c5808280431c0b0d6a64fb2dbc77f3e79ddd563b039dcc821b30bbf8d55863066f48c8fb3c1e8504754a77238eb65ce35e309c1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x3ba34f2",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x4e0ddcc7723b6adb8b04553005bf7d2b92ff21515a2d475ed7cd904adf463ea2",
    "transactionPosition": 3
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x37e0b4f",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182084081820d58c0a621f85fb8c62ff3dfc46ceb3c8b39eaf26d12058084cf132e8b929e76d78b09f8dcab75ae6b8fb0c08cbb19401282b8a22a134dd6501245016c6b291475ffd9f5c849472158d35a4a2fbb1c3ae3a9659c6977bbba744ca93d88ce6b8463c2240c76e0369b0b7ce704c125ee0a1659bbe480f9332d93ce5cdfc8a4165a375faca2f7dd6f32b1ad5e7139a67132abc88fb92087b5bbfc783c538b72f940ff1270670a8d4cf75c00f841f7428a4882fc81ba7e878f130d4d064c32b297db1d83b61a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x32c5c44",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x0ff1f5cf62ea3d5bff02b2179b65e04351887c8818c674566b97c40f00bb31cb",
    "transactionPosition": 4
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x373949a",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285108182094081820d58c0894b04554ba37a92ed433153a56ef1252a8c9b03c959eb389de91e623f8ed365dde113420eedc91ecc4e3ddd6b7769ec9300462f93ca58128694b0e7479ef0e055cfb5852f19e3cf682ba5ef3508b42e25f9b3fc8b3eba3b49d8343d5e366a3500a8f48a186b76cc22b4caf1496d209daacd2bc310de177f820c9acf354bc12d26f90f36a18a63c90d7a8857e6c0c608b63488ac62d688931752d4664331b1445aaf9ee9b2d394e48282f89e1eeef729617a097817ee1aa62a2cf5219f9d02df1a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x344d3f5",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x037fde0b4fd04ee19c25d3ede9e65a37726995e3b11e8d475035b26db230782d",
    "transactionPosition": 5
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x3780216",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2851081820a4081820d58c087803bf7ff2604290afb95c3e1084540ead1f85b60816b716253e741d9637f1521c4dc70f6b3a53f593104e7d063873ba924e36be13b16f6bcc594199faf091c36c65bc971026e24af1ee7b20aeec80a3cc4edf7444bb1ae5943ff4cb01027fb101199f22ef757fbe6e7ef13560b7d0558fe5270cd529907d91c223f61a31096dab63246b7717cd517b8d68744c193f68b60d96b1f4eaf7761e87ceeea4fc378c1709b29e19d762f50ee1b8337e5f96135c35837a2d858b66116d0e1eb2800541a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x322a428",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x98021260660c66e6be8af4b99f97e941b6ddcb2c48e84d2d0ad338522159a706",
    "transactionPosition": 6
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000012e66c",
      "to": "0xff0000000000000000000000000000000012e5f7",
      "gas": "0x374cedf",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2851081820b4081820d58c0b6f12b90e50d2c0b86f2cc341a1e8a7787c2e78b933f4613a7af22cdfb66ce15a53bcd9f79092ecd91d0677310f86791b3142770e01ecf3a9eeab55ed5294435d108773019404632105da406f9558eca8bf25295c0a6d5885c95f24e65050e7203c7d40e07a30103ef93233b137908ef4ea3fc3d0741c0bf1c3f439ec4b23fbff6be77e190cf2ba6f7bd609b10055ffb931645123bf6d85ead1fa04e6800717ff253eacf5d3bb9ccc8afadada897aae831aabfc20cabed2ff25d0a24f37a3c501a0037e5f358205ded7c8109656ee788ec8de051bc70331254b551d154eac21abf8fcf339d86b50000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x32ae600",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0xd3989d5f90ec878cc091194075bb9ed447ccae35a8dcc4035fad9c44987c55fd",
    "transactionPosition": 7
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000023c695",
      "to": "0xff000000000000000000000000000000001d922c",
      "gas": "0x1a964d9",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285148182004081820e58c0a24cb66ff00fd1f20a84a596a215dc56f44b240eb7c7fa2a9cc1f103a86388ee860b5ba5e6cba7cd8869b194c1b45fc292ae448fc49a96f16b891ce29aa6560f36273080297214c94845cb210144e1a237a82e427eda1bbcf75bb8fa914134c118c6687cf61f857e92a1f19cb6547235ac0802384e5e6b5fbdcf81dfa3b8a60aa92ffd452ff362aee38dacd297c611f3b5de12f612b38a366f3353274f784d820956afd67eb365d4cd53af1140ed2bed9bcbcd31da2b58b83651994b3bc694451a0037e60358202f916e2c95962eb5027d2f5fc467e9983027e6da80714e1b7169cda64ff2bb610000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x17effb4",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0xcee1106b264da4388f0b82d3eb834d75a5c82bd5baa76f58f56dd2d4df8f118b",
    "transactionPosition": 8
  },
  {
    "type": "call",
    "subtraces": 1,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002af64b",
      "to": "0xff000000000000000000000000000000002af684",
      "gas": "0x490a329",
      "value": "0x1734adf7a686149e",
      "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000789821a0002997259078097f66fc0113af242cae4bb45a9a217eb538185b0b3cdcf059af23b77984e794d0dcb1994ca805f5621818d80b192ac269665ef565bcf33e86568c0b2ce805875dd607cf8875725c94646f87adc591a1d1bcdad9e5defe0474898ecc9178e50a709f7a49c4d41de880fa7dccaefecd9c4c499fdf84eac1446e23b9c746d2f929afce10a9fe4085d7f9af6a883e9bbe85995e07b2277e58a4bf8d106490a989c0d7fba52162a15d5d1de3580238ca8bd84c341fd5e3dd90e58604b44e9e6efa26f8bdb01f81f72e8a90e4d3781e6ee575ced52406e111c29cf8d39d394079ac4678c907b2e9b2aee659ea7f1862cb73805ab42c3f7962a6c63e43d5615da1fa4620c5accb67f30463512afe1ea313367efabc66d132eca27dd4edc5a4f88cabe6517ef84269d1db59b0a9b5df61babf9f4e60f2a9ebd6bb2f1cf4c51fb3e899a64866b05775a76d9d02835c7c72dbe9c1aae0eba486b759688b26bcf3dbb8a56b99fa90219b4b72ddf96c198bf37309c0e87f7bbcc4207397efd93176508b1948b83b9d29e6fb9eb90f175c634374e662ca6618c27b4044caab2682b295e490bfaa3816b6856ba95b07c88a4d354f66526b6bcd48cb7b3dbe34651c7ed4fe0522a802c4abd8c9865bed859706476ef28e65e0ef995f6ed4355cd2ad049b28b479218a2d145c48484b15997e1e50e0e811bb25da5e299970d83cc12e927261f4672444f24a7181364dd2c0a46f38aa24bd38284398e866b5012d763ee70fa8c6851c28083cc47a3ce35712dfb578f99c2cb878f0eab25e380dc88ee6ecb705b31cb9492c01937ef66e226efc048dd5ae78cacf8391056d4d0555bfb37ee93865b5d79d73609b3b80c5c22fb22826834e81699a29fe7667d577fb4b1719fbbdfb988afe34d91b009a0c92f6a9f33f04e4237a5b5db7124d46b80d4af0592e338790008841c0d1562229a78bfa2e0a084e4144aed4edac7a8b7504848979452ad547909552382b655009bc4257d96f0f3fe39960fe3ea1a5c6ccd0d5bf09462f53b8bb298abfd5c5a039c7bf4d76f908574827ff275e129a29f057b3410d61d35788db2eadfc5b32ae50b3169df0bb625ca5a88dda75e0e4d5bf16b669df3ce3e3abd89bd5369ab8fae5fc4fef3b427f991ab800c9207df5028ceec134b6d65b62ee8feca0014c1a5bb13473bef7c64589df5300c1ce2b9bf52a4b296a21f7e64506a0d1dc5fcd208e71cb66df368346857546e886bf6961534d4208c312a415c46951fde39ae9fe2716fb76f93a654b260a584339bf04f08e92b09364de4079533fc5685a0379bd07a63c8d8c0d5150ccd54575138fcdcfc386ecca7e176f0369b7f830271d00f756227bf1858ff0c4b0a39db2586f81f1c2eb94e6dd800c41604a7daa5893f880fd0ec02196e5fed08f2f7837de91e9ab414479e220bb734a20081ff3709d623548efd15fa09dcb976aee94e61e54261b074f4e43a88ece20d167a0c8a255ca5da4197cef5bcaff55f80e7a4016a2bddcd9a772ea3a5b311041c4912087260c7028b17076a3a580da693eb98b25cc3ac3384cfeca799f185fadbe4a24a87d40e675ba2324870fe946d28c38bd385a8e75dafcb7c17209fc6ab477196a9d0b8c1cd853a41a6a99431114cb391a62449fc2b9a17149c321ed7937cb6a5f534fdc6cfc0ba7b96e0f7c9141e49905c40df94acbc1375f8d6d04101dd3b2aa031b68c27f50158879e705de80672abd7708f88d3446cb19261533a34e26a17ffa04395e3d130b13a96081f1d9c06a235168c6c81d471aaad92d5a9ee4b9f02822ac53d3ef5ce2020f47bed59d05999c3916325105c6a052870f678fe52019150bbafaf4f06db0bfc6f1f3461fc205e84a3232bd885ef2b7baf7e635e4730b29631c723318c7c37671d30c26e967804aa34c94eb927c868c0eabbe394262c18699d7275a735f2a5e5191c64dccd03986556e7f541475bcec57a8b43baab5f915168872d46d5a3292db6da12f75eb57ca579f8bc4dd9ab206cb5fe7cdf3031135515d8d01802fd78ad24ef1fc91814e010620e8a6eec9f7c0fd5efbee822072dac9f21965fde15fde86b25eabc02818a2e92d997c4ea0b2903bf0a7d3ec24754f6105511f72880810133487b02754bad91d57a342fc9844077b0b082158d728b2c3bc0ec07ca096f2996eeb83e3b45934a76d8e98b9afd8f11899aa15b374ce63108375fd93386ae4e4e0b0d6c22d4acfa0983faddeee59869e54919ee7a52a3fb87e528ed6b63172a647974534f957808b0720656dc5b963a2111edab5a731559a8935397c786869d96f60a1a5c0c4ad57084262a2b33139efa864eeff0d350327903b1db5ac981e6603160b47308b9570a8d0a0a33816b7b35dca64d40b9316ab9bb9d29b10fc09072235758da48817ac298870691e245b099cc7a7298f490e46609a8de673cc645d4dadda47a13291bf52c7eceeed22bc18c522a9063c81fae43eb13f04f1473421d784f05b7f9a595a053fa3be4fe7efba02cc23d4f4c1111bda71774695176c79c904f1d7863044004055200cef7c76e62d9902118cf063dd599b0d30824074e0306cc3d01f18d68aa46aa986e3146847e0e23289fbc9e30e13a54d39885bc65de72eb7a7756a44bc6effe2584f1a8ffba854295e4d98d3ae515a551538aded3ed59e034b9c24ab3e7792aecdb84c7e6443bc5f6932e0000000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x773e01",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x4d88a10bcf487e66019cae5da1f3e29fd36de5ebeabe342d034b0dcc70bf32f4",
    "transactionPosition": 9
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      0
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002af684",
      "to": "0xff00000000000000000000000000000000000004",
      "gas": "0x44a899c",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000008338808821a002af6841a00029972811a045b2b535820c4602a2df716d569dd747e0fdb722f40fa6ee1a9fca69c250bd098de14a9b3ff58203ea65ad0e910f3d9e0556bfe40f97e34cf87a3307197b1f9fedc51dc291f828859078097f66fc0113af242cae4bb45a9a217eb538185b0b3cdcf059af23b77984e794d0dcb1994ca805f5621818d80b192ac269665ef565bcf33e86568c0b2ce805875dd607cf8875725c94646f87adc591a1d1bcdad9e5defe0474898ecc9178e50a709f7a49c4d41de880fa7dccaefecd9c4c499fdf84eac1446e23b9c746d2f929afce10a9fe4085d7f9af6a883e9bbe85995e07b2277e58a4bf8d106490a989c0d7fba52162a15d5d1de3580238ca8bd84c341fd5e3dd90e58604b44e9e6efa26f8bdb01f81f72e8a90e4d3781e6ee575ced52406e111c29cf8d39d394079ac4678c907b2e9b2aee659ea7f1862cb73805ab42c3f7962a6c63e43d5615da1fa4620c5accb67f30463512afe1ea313367efabc66d132eca27dd4edc5a4f88cabe6517ef84269d1db59b0a9b5df61babf9f4e60f2a9ebd6bb2f1cf4c51fb3e899a64866b05775a76d9d02835c7c72dbe9c1aae0eba486b759688b26bcf3dbb8a56b99fa90219b4b72ddf96c198bf37309c0e87f7bbcc4207397efd93176508b1948b83b9d29e6fb9eb90f175c634374e662ca6618c27b4044caab2682b295e490bfaa3816b6856ba95b07c88a4d354f66526b6bcd48cb7b3dbe34651c7ed4fe0522a802c4abd8c9865bed859706476ef28e65e0ef995f6ed4355cd2ad049b28b479218a2d145c48484b15997e1e50e0e811bb25da5e299970d83cc12e927261f4672444f24a7181364dd2c0a46f38aa24bd38284398e866b5012d763ee70fa8c6851c28083cc47a3ce35712dfb578f99c2cb878f0eab25e380dc88ee6ecb705b31cb9492c01937ef66e226efc048dd5ae78cacf8391056d4d0555bfb37ee93865b5d79d73609b3b80c5c22fb22826834e81699a29fe7667d577fb4b1719fbbdfb988afe34d91b009a0c92f6a9f33f04e4237a5b5db7124d46b80d4af0592e338790008841c0d1562229a78bfa2e0a084e4144aed4edac7a8b7504848979452ad547909552382b655009bc4257d96f0f3fe39960fe3ea1a5c6ccd0d5bf09462f53b8bb298abfd5c5a039c7bf4d76f908574827ff275e129a29f057b3410d61d35788db2eadfc5b32ae50b3169df0bb625ca5a88dda75e0e4d5bf16b669df3ce3e3abd89bd5369ab8fae5fc4fef3b427f991ab800c9207df5028ceec134b6d65b62ee8feca0014c1a5bb13473bef7c64589df5300c1ce2b9bf52a4b296a21f7e64506a0d1dc5fcd208e71cb66df368346857546e886bf6961534d4208c312a415c46951fde39ae9fe2716fb76f93a654b260a584339bf04f08e92b09364de4079533fc5685a0379bd07a63c8d8c0d5150ccd54575138fcdcfc386ecca7e176f0369b7f830271d00f756227bf1858ff0c4b0a39db2586f81f1c2eb94e6dd800c41604a7daa5893f880fd0ec02196e5fed08f2f7837de91e9ab414479e220bb734a20081ff3709d623548efd15fa09dcb976aee94e61e54261b074f4e43a88ece20d167a0c8a255ca5da4197cef5bcaff55f80e7a4016a2bddcd9a772ea3a5b311041c4912087260c7028b17076a3a580da693eb98b25cc3ac3384cfeca799f185fadbe4a24a87d40e675ba2324870fe946d28c38bd385a8e75dafcb7c17209fc6ab477196a9d0b8c1cd853a41a6a99431114cb391a62449fc2b9a17149c321ed7937cb6a5f534fdc6cfc0ba7b96e0f7c9141e49905c40df94acbc1375f8d6d04101dd3b2aa031b68c27f50158879e705de80672abd7708f88d3446cb19261533a34e26a17ffa04395e3d130b13a96081f1d9c06a235168c6c81d471aaad92d5a9ee4b9f02822ac53d3ef5ce2020f47bed59d05999c3916325105c6a052870f678fe52019150bbafaf4f06db0bfc6f1f3461fc205e84a3232bd885ef2b7baf7e635e4730b29631c723318c7c37671d30c26e967804aa34c94eb927c868c0eabbe394262c18699d7275a735f2a5e5191c64dccd03986556e7f541475bcec57a8b43baab5f915168872d46d5a3292db6da12f75eb57ca579f8bc4dd9ab206cb5fe7cdf3031135515d8d01802fd78ad24ef1fc91814e010620e8a6eec9f7c0fd5efbee822072dac9f21965fde15fde86b25eabc02818a2e92d997c4ea0b2903bf0a7d3ec24754f6105511f72880810133487b02754bad91d57a342fc9844077b0b082158d728b2c3bc0ec07ca096f2996eeb83e3b45934a76d8e98b9afd8f11899aa15b374ce63108375fd93386ae4e4e0b0d6c22d4acfa0983faddeee59869e54919ee7a52a3fb87e528ed6b63172a647974534f957808b0720656dc5b963a2111edab5a731559a8935397c786869d96f60a1a5c0c4ad57084262a2b33139efa864eeff0d350327903b1db5ac981e6603160b47308b9570a8d0a0a33816b7b35dca64d40b9316ab9bb9d29b10fc09072235758da48817ac298870691e245b099cc7a7298f490e46609a8de673cc645d4dadda47a13291bf52c7eceeed22bc18c522a9063c81fae43eb13f04f1473421d784f05b7f9a595a053fa3be4fe7efba02cc23d4f4c1111bda71774695176c79c904f1d7863044004055200cef7c76e62d9902118cf063dd599b0d30824074e0306cc3d01f18d68aa46aa986e3146847e0e23289fbc9e30e13a54d39885bc65de72eb7a7756a44bc6effe2584f1a8ffba854295e4d98d3ae515a551538aded3ed59e034b9c24ab3e7792aecdb84c7e6443bc5f6932ed82a5829000182e20381e8022036ea0ddccbc309b556e4fdc791438210c26b8b03c39d18834ba80a36bbdd2d6cd82a5828000181e203922020487c0c209649065502b78229fc0b7615d57ece831e64ce43bd3d8c9c42a8c72b00000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x2ddb87d",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x4d88a10bcf487e66019cae5da1f3e29fd36de5ebeabe342d034b0dcc70bf32f4",
    "transactionPosition": 9
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff0000000000000000000000000000000011edcb",
      "to": "0xff0000000000000000000000000000000011edd8",
      "gas": "0x1a9c56b",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850d8182004081820d58c0a319a243963a781b9065dd3cc6cb01dd443611f71e95c03b2c43067837920f7c0091d21220384a8d9fbc2b7485aece108ff8910a39017f80753b3dc546957d44fd949fa40facd72ff1f62b3d20dfadfb1d6b5bb0716284bfd4e0b80078039d500e43ccd19408e9f8f2e355df930feabe48aa2d27426bc1f5f9a3dfc08b1f7ab1d699abf7d86811e82e261575be40bdac8bbec5b061f3bdcbca100996367c6e4e33a7aed7ab5f4d9543a5a69f89ad068a150a29e0aacbed0b50803956fdf161531a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x16185c7",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x0ce7f1628f49ca1f4714588d59b6c3fc7791441a7833af66e373be1c4064b926",
    "transactionPosition": 10
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000001e4c50",
      "to": "0xff000000000000000000000000000000001e4c4b",
      "gas": "0x1a4fb4d",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f2850b8182004081820d58c086ecedea35396878a90a05fd41b2ed46c73869919a9c07fe1ad04d67f97b9bb0040c70eb525811ef34bc95c4664979ba887ac5fe5539cefa9ad5d572cbe31833dd735eae1e3afd27982c2058e68ef536fa96211b0a236edc47904dd9e6028f95101167d96f9b7ca02324ed4f51120454c6be09703b0ce0d6d66e6150f1c11544b2a3ba052eef2233fd8c99d0818754efacfd3fde07189a9b927073627d23177dbb1908fbc60ec768af3b957833df277f702e08605456646890744f16fdc256231a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x15db0e5",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x12dbb560d3620454a40e275965817a7fe23c82e2e6870a32261d1e1469e7694e",
    "transactionPosition": 11
  },
  {
    "type": "call",
    "subtraces": 1,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000001b6165",
      "to": "0xff000000000000000000000000000000001134fe",
      "gas": "0x304eec29",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f9851381820047e03a7420ed060181820d58c0ac75f6bdc5cef0564f0d17c739ef653c268ab69c15398de184d3a078f758a7948b81092f68636a6932ce7a13bb8a7ce38910b7287ac053bc9b33c33dfae64e5488103cd61842f1436f844cd71f67d69ef5fefefdcf32d9c759a0b63e878381f009e3b8a1c77ff44855979bec458688aba0538f793866d0736224f55e689597207c315007cccd3fdecba298b46b59a364ace16c261151728065e32a59505eafda71866382dea9138bda682ac474030a49effab33f17a5119a8181b3a416737c931a0037e5e758205d5641b3010b198d37a1939dc3e78c500a46a23f433f5c1e5cb8b8847ce653d900000000000000"
    },
    "result": {
      "gasUsed": "0x25482600",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x333b9ec6232ca0b62db161908423e51e9c15847dc1af46bea47ecfbc5c9a1de4",
    "transactionPosition": 12
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      0
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000001134fe",
      "to": "0xff00000000000000000000000000000000000004",
      "gas": "0xb1b85b3",
      "value": "0x0",
      "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000f8246010800000000460150000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x1699cec",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x333b9ec6232ca0b62db161908423e51e9c15847dc1af46bea47ecfbc5c9a1de4",
    "transactionPosition": 12
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000001258fe",
      "to": "0xff00000000000000000000000000000000110330",
      "gas": "0x1b7e49d",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285028182004081820d58c0abdbdc0a9b0148ce1f4cc7774bbf9f8fb55359a26601885ac33ed35e76777a4bcfc34970fcd77ddbcae1eb1f7482d886aa811dbb853217324c2e3883c72dc559aa75e59c266ca217c44d1bfe2d7454a35c6b58a66a46e1e8ecde020d596e3c5b18b5c4111bcc5a02a840b5eaef79804cb8495df887488c77ca3d39aac9fb2e8d6029075253f8574896e98a6467aecb12b36223ecd87ba86489b351e004dd803e701a5545df4f04b499894f564240b5b812b84d4a76171e22153dff71d0c076b91a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x16c053d",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x78c49827be7cb10a97def7625f879f784e74d319f0163e41a0bfb9e69bd50a23",
    "transactionPosition": 13
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b3cd0",
      "to": "0xff000000000000000000000000000000002b3dda",
      "gas": "0x2c685ac",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001b685128282004082014081820d590180b06714322c16170ecb7c9c0368bca79c52e042c91842f054d7ff485b6f0eebe6eb842984fc8fb422f6aeee8014dd9318889569e50128dd7836a3a772b3cb42b74b5683bf14f0f6f2408365594f66c0dc2b9892240e09288bbc5c581edda19f4d01e95a51180cd10582f7c98a65b0eed7285e99f8a0ac9f9da0d65ae7a9fbd0c15ca17feb4707418f8f290079e9e0e7fb9149a2a00ff464b45b456962ab56bb3c22f0385cda8d34487df04e7a8f97e5bd1afa7fa79e6057ae32dd840c2b65308da9c82b53bbaef4e6ec4ca0a0ed87f48d69232ec9ed7dfdc27ec802ea31bed16f936bc6c3e6a1bd7a9bf866065eb33ce2b982e2138648025932a9f5d44a4e164ebea35a41267a0ba86be5ed21764d0f120275658d1480be047ded3fd6f1e5f7f611b774515ff8669dfd229401058548a21ebdfdc5f9e2ac6a045d6b4c9e095f37d2ae66d7e7b44258a47aca8cada74470a2efbd48c33cb04479ffe5cf1c0a2251ad6930a75b7381ee9fbce76e1bb149dc72a72f9e7ac0c7b66f9c4080e32703661a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d6900000000000000000000"
    },
    "result": {
      "gasUsed": "0x248721c",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0xc7602fdaef4828a493b88f871dcf5c5750270f84c69f609c4ed047b30e49ab21",
    "transactionPosition": 14
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b42c9",
      "to": "0xff000000000000000000000000000000002b2288",
      "gas": "0x1919d9a",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f285018182004081820d58c09315579871183fc3376dbacee3f035e3740908c1c2dff5930be1c84897435c1fdb3a3381fc674ad538ae651328dfbae2adaf6cc61cb8677c27c0fa6bd966544735584e3b2417df9697ec1af32e07a53c68be0dba944b20a0df6d66a1ee74af6606460b398e6a5e76c7aefb8426b60a89014c62db52ae4b946bffd71ebc66d9874829e31f1777c487a86f64cc785e1d9f91d5d367a76a699b368ad9cb21da81bbe3ca211498d38a4d3669b33b1f8dc7404fdb2b87db35f82482819509e38dd70d1a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d690000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x14e3bdf",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x32042ed62912073406b1f825b0d4baf5256b6773cfcab6c269352c74f6b7c39d",
    "transactionPosition": 15
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff00000000000000000000000000000000129602",
      "to": "0xff0000000000000000000000000000000012968a",
      "gas": "0x219f358",
      "value": "0x0",
      "input": "0x868e10c400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000f38518258182024081820d58c0a4c24df9a93858d253c0b949ab0cfd5043f8243151ae45eaaa8836e1d5c7668fe6d88c1b8ea0d172543c781f5cb35fe8b4b97f5cd4495bcc3d60c4d475707afd9ecc87dd4abe324c80c86c8cbe557455b5d67f473018cbd37fe02a95e4603d740c2f2e281124b9ce62ec8279a9b8c0cf4722657cdfb13ded895f089eac23da5835281fe1dec4fe041ee5d2bb5cf0dfe3a1388b3f4bb1c898cdc9e16b9bfb2880798d1f892074ef35c4524f3212f181020c012f6396f9a5f90968871334397d331a0037e5f8582047ab5fe94c06cdbaec8b74525a8ef23928a1bbb62440ccbcd599b10154404d6900000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x1bb5b3b",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x89d1a98260f8ce9a489e96618fc2eb9a71aae288a0dce7e576cc9f92777bf78d",
    "transactionPosition": 16
  },
  {
    "type": "call",
    "subtraces": 4,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b2b89",
      "to": "0xff000000000000000000000000000000002b620f",
      "gas": "0xa24a14c",
      "value": "0x1411b1db93e7400",
      "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000089a8194870819ba01d82a5829000182e20381e80220093c553e711af9713a922b0a6a904eb17092ad8c5f5f4dc072c47235c4befd721a0037dfff811a045b26c31a004fa108d82a5828000181e2039220203f3de710bca81902e9c52aa8a856501d7597cb246059090e1a122a6bf3cc0d24870819ba91d82a5829000182e20381e80220d680339874b015ea1e6f62258dd33039d11d6e52ca2ed52d75710390146ef9031a0037e0a5811a045b33e31a004fa109d82a5828000181e20392202065c3e8e0b9d5e7a3c98c22481ccd92a02df2e940dec694d41b65b8a159bff530870819b948d82a5829000182e20381e80220c8ba717e0876f47d552a01c73caaa0a474fcb68d5191646b77faf23543bd80361a0037df37811a045b123b1a004fa10bd82a5828000181e203922020ecd65fb1dadfb1c73d465961ab5670d04ab5f16778ba538e377863628da9210f870819ba8ed82a5829000182e20381e80220d4308d1779e1d8a0cecc71a1bad51c00d5e8548f97897e393f492a98e7605c4f1a0037e0a1811a045b33e11a004fa100d82a5828000181e2039220208da956908f35641d819d6ca593f70da0f0bc50178320c0f2b5d98f845e225908870819ba3cd82a5829000182e20381e8022038edc7a8c7b4a3709dfacd2740137e8e129142ffb8e927ea5a9edbb6c64567251a0037e048811a045b2bef1a004fa102d82a5828000181e20392202067e6ff31806a59a94409982748b7b95b0b3e111831a4cd1082e45c28316a6412870819b925d82a5829000182e20381e80220b813d4997aa7758f20ff8a61a3c85a424c095600f19affa27f131388351df4501a0037df06811a045b0e301a004fa104d82a5828000181e203922020fc03bc87e425b22b4ccced611f45235b986b85f108f3f2549bcd4eee9290cd2f870819ba50d82a5829000182e20381e802202482832ae44ad6cd1a2e6a2b7619b26b7b7149eabc950010bc1866875d029e1d1a0037e05a811a045b2df11a004fa106d82a5828000181e2039220202661ae0bcacdec750b339f0ab0ce9328f2692058ae1045968e0edd5f7b3dd811870819ba39d82a5829000182e20381e80220dd0de1bdfc9c1619c66b73b4bf977f3b3447c68c27aa10ded4555a12ab3a2f511a0037e047811a045b2beb1a004fa107d82a5828000181e203922020d1d07a5a06841c47767b57ef90892dbaa6023e96124a3f76148c58368cca2617870819b9ded82a5829000182e20381e80220027e1870716e523c0f3d08715b2a1490e446125fbd7d2e8022fd303e3c56f93c1a0037dfe1811a045b24031a004fa108d82a5828000181e203922020f29aacc7c8fe59516a3b527547eaf8d250d2f48f981cbf311166fb0d9c031808870819ba6dd82a5829000182e20381e802206875104c4ef4690f4589759cca1f539fa69e9673deb29a68453abc7140da57511a0037e071811a045b30281a004fa110d82a5828000181e20392202009cbd082f5c1b3806813ae5240871a7e99adddec8696ccb63409829969e90513870819ba15d82a5829000182e20381e80220880db767d7ad153fa104053668a3dcefa92d626d76e1abc9f685674f1ffbc83f1a0037e017811a045b27f01a004fa0fed82a5828000181e203922020d102fcda4fd8039589c643cb8a40c68f6fac58b780572d5c786ec3d911c65221870819ba38d82a5829000182e20381e80220a94505e3725f268c7cb9ad1ee0538de448b2999894ddced47e43fa43dad37d4f1a0037e042811a045b2bea1a004fa105d82a5828000181e2039220200cb6f8071eab0af5717dfe15386545450b7e931cd9c08dcd47f5ef6006f40d34870819ba69d82a5829000182e20381e802202012760d042b85e82cb9f87fed5736c0936e9d4eaf003de6074cf35de125c5591a0037e072811a045b302b1a004fa109d82a5828000181e20392202000068b68d6d878c79e8d6c3747c52c39ff17f60bf6e9c8baa0db5e487a6e4105870819ba55d82a5829000182e20381e802208966b25c9e3954eca9ea62c2ef736fe1a78e72d1d9b2c1030f4a9f0af1ec5f321a0037e063811a045b2dee1a004fa10ed82a5828000181e2039220206c73256ff2c356844554e46940dc1df9fd03156c148b40a39732db2b1bb9e228870819b9ecd82a5829000182e20381e8022013f73f929cd0028ba741b3796b8d8ea1fc7bd22140e228767573ef84619666231a0037dfe9811a045b24ac1a004fa110d82a5828000181e20392202017c9587ea90cc9d2394afe6ce5e78ba20b0282aff1fecef387465f6903d73d33870819ba2ed82a5829000182e20381e802206f9dc8dc410c97bedf1b7cc1d72d15abf1e7918f84cd8dab15ef1cf9889070091a0037e038811a045b2b0c1a004fa0ffd82a5828000181e2039220203565803f11d30abdde5e2c8f99bd2160791c62175345f68c20aedc61110fb53f870819ba0dd82a5829000182e20381e802207c7241beb346264e70baef27c4191100515937ee353cf04485e718f03d537a641a0037e010811a045b274c1a004fa102d82a5828000181e203922020781476353489a83554fb6ec661e03fd81e2f92a8de6b7871ef76607d9d636127870819b617d82a5829000182e20381e80220f1841d865f1de264b0c50c7f8e653e61ed65734ac0ddaace8089d1049d9f855b1a0037db02811a045aaec81a004fa102d82a5828000181e203922020964507149377a01e67dc8ece2da6c9b49418687d75676f351c70567ff9628821870819b9d3d82a5829000182e20381e80220134d720e957f2dafa018b497bdef3d69bc67c3d429c43562b3a6211ce76102591a0037dfca811a045b22b71a004fa103d82a5828000181e2039220204ab78880ebe55d1606957e0b2e9ffcbd599b9545d5245c48f4db7b1b0e7b0b07870819ba97d82a5829000182e20381e80220a32b01b61da64c40030ef19ecc0b07aa93be21853fcfe6573a3a753a58da2a151a0037e0a7811a045b346f1a004fa10fd82a5828000181e20392202049e915acdfd6178f081d37cd17d86c8143415a65a2d6d4d72c52998888679332000000000000"
    },
    "result": {
      "gasUsed": "0x61131c0",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d",
    "transactionPosition": 17
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      0
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b620f",
      "to": "0xff00000000000000000000000000000000000002",
      "gas": "0xa0a644f",
      "value": "0x0",
      "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0xfabb0",
      "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000418282581a000286387ff107ef952f3612eb2e2a6606418e51c0f2cceeda5f57011731c2a04034dd33df402838a815a0b69ec1184b8c104a0001c0dfc71cd077c4b900000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d",
    "transactionPosition": 17
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      1
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b620f",
      "to": "0xff00000000000000000000000000000000000004",
      "gas": "0x9f99f07",
      "value": "0x0",
      "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x105fb2",
      "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000578449007d2903b8000000004a000190f76c1adff180004c00907e2dd41a18e7c7a7f2bd82581a0001916cb98a2c3dfb67a389a588fb0e593f762dd6c9195851235601fba7e16707ee65746d4671e80aa2bb15bc7d6ebe3b000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d",
    "transactionPosition": 17
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      2
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b620f",
      "to": "0xff00000000000000000000000000000000000005",
      "gas": "0x9e66af0",
      "value": "0x0",
      "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000005100000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000106819483081a004fa108811a045b26c383081a004fa109811a045b33e383081a004fa10b811a045b123b83081a004fa100811a045b33e183081a004fa102811a045b2bef83081a004fa104811a045b0e3083081a004fa106811a045b2df183081a004fa107811a045b2beb83081a004fa108811a045b240383081a004fa110811a045b302883081a004fa0fe811a045b27f083081a004fa105811a045b2bea83081a004fa109811a045b302b83081a004fa10e811a045b2dee83081a004fa110811a045b24ac83081a004fa0ff811a045b2b0c83081a004fa102811a045b274c83081a004fa102811a045aaec883081a004fa103811a045b22b783081a004fa10f811a045b346f0000000000000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x2183932",
      "output": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000051000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000003728194d82a5828000181e2039220203f3de710bca81902e9c52aa8a856501d7597cb246059090e1a122a6bf3cc0d24d82a5828000181e20392202065c3e8e0b9d5e7a3c98c22481ccd92a02df2e940dec694d41b65b8a159bff530d82a5828000181e203922020ecd65fb1dadfb1c73d465961ab5670d04ab5f16778ba538e377863628da9210fd82a5828000181e2039220208da956908f35641d819d6ca593f70da0f0bc50178320c0f2b5d98f845e225908d82a5828000181e20392202067e6ff31806a59a94409982748b7b95b0b3e111831a4cd1082e45c28316a6412d82a5828000181e203922020fc03bc87e425b22b4ccced611f45235b986b85f108f3f2549bcd4eee9290cd2fd82a5828000181e2039220202661ae0bcacdec750b339f0ab0ce9328f2692058ae1045968e0edd5f7b3dd811d82a5828000181e203922020d1d07a5a06841c47767b57ef90892dbaa6023e96124a3f76148c58368cca2617d82a5828000181e203922020f29aacc7c8fe59516a3b527547eaf8d250d2f48f981cbf311166fb0d9c031808d82a5828000181e20392202009cbd082f5c1b3806813ae5240871a7e99adddec8696ccb63409829969e90513d82a5828000181e203922020d102fcda4fd8039589c643cb8a40c68f6fac58b780572d5c786ec3d911c65221d82a5828000181e2039220200cb6f8071eab0af5717dfe15386545450b7e931cd9c08dcd47f5ef6006f40d34d82a5828000181e20392202000068b68d6d878c79e8d6c3747c52c39ff17f60bf6e9c8baa0db5e487a6e4105d82a5828000181e2039220206c73256ff2c356844554e46940dc1df9fd03156c148b40a39732db2b1bb9e228d82a5828000181e20392202017c9587ea90cc9d2394afe6ce5e78ba20b0282aff1fecef387465f6903d73d33d82a5828000181e2039220203565803f11d30abdde5e2c8f99bd2160791c62175345f68c20aedc61110fb53fd82a5828000181e203922020781476353489a83554fb6ec661e03fd81e2f92a8de6b7871ef76607d9d636127d82a5828000181e203922020964507149377a01e67dc8ece2da6c9b49418687d75676f351c70567ff9628821d82a5828000181e2039220204ab78880ebe55d1606957e0b2e9ffcbd599b9545d5245c48f4db7b1b0e7b0b07d82a5828000181e20392202049e915acdfd6178f081d37cd17d86c8143415a65a2d6d4d72c529988886793320000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d",
    "transactionPosition": 17
  },
  {
    "type": "call",
    "subtraces": 0,
    "traceAddress": [
      3
    ],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002b620f",
      "to": "0xff00000000000000000000000000000000000063",
      "gas": "0x2176414",
      "value": "0x123ea1b057e9800",
      "input": "0x868e10c40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x1770",
      "output": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x578dcd2316d11d619e685216afa861d1eb631f38b4fdbf4a189088485f2db90d",
    "transactionPosition": 17
  },
  {
    "type": "call",
    "subtraces": 1,
    "traceAddress": [],
    "action": {
      "callType": "call",
      "from": "0xff000000000000000000000000000000002d33a0",
      "to": "0xff00000000000000000000000000000000000004",
      "gas": "0x548da5a",
      "value": "0x0",
      "input": "0x868e10c4000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009185583103b39880989620c017d43ab24caf829d6d2b1cb27401aa18ba501d87d32526973a498c8879fb1833f2c4198c3634753bfd583103b39880989620c017d43ab24caf829d6d2b1cb27401aa18ba501d87d32526973a498c8879fb1833f2c4198c3634753bfd0d5826002408011220b6da1051bedb96e0c5636bad2656b365291dbd94f1482642b8a5e51edffaafad80000000000000000000000000000000"
    },
    "result": {
      "gasUsed": "0x170f6f2",
      "output": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000510000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000001d824500e689b501550278e8a50631934966637b6ce6ad7ca7e3c68c5995000000"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067",
    "transactionPosition": 18
  },
  {
    "type": "create",
    "subtraces": 0,
    "traceAddress": [
      0
    ],
    "action": {
      "from": "0xff00000000000000000000000000000000000004",
      "gas": "0x53cf101",
      "value": "0x0",
      "init": "0xfe"
    },
    "result": {
      "address": "0xff000000000000000000000000000000002d44e6",
      "gasUsed": "0x1be32fc",
      "code": "0xfe"
    },
    "blockHash": "0xbeef70ac3db42f10dd1eb03f5f0640557acd72db61357cf3c4f47945d8beab79",
    "blockNumber": 3663377,
    "transactionHash": "0x86ccda9dc76bd37c7201a6da1e10260bf984590efc6b221635c8dd33cc520067",
    "transactionPosition": 18
  },
  ...
  ]
  """

  require Logger

  import EthereumJSONRPC, only: [id_to_params: 1, integer_to_quantity: 1, json_rpc: 2, request: 1]

  alias EthereumJSONRPC.Geth
  alias EthereumJSONRPC.Geth.Call

  @behaviour EthereumJSONRPC.Variant

  @doc """
  Block reward contract beneficiary fetching is not supported currently for FEVM.

  To signal to the caller that fetching is not supported, `:ignore` is returned.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_beneficiaries(_block_range, _json_rpc_named_arguments), do: :ignore

  @doc """
  Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_internal_transactions(_transactions_params, _json_rpc_named_arguments), do: :ignore

  @doc """
  Fetches the first trace from the trace URL.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_first_trace(_transactions_params, _json_rpc_named_arguments), do: :ignore

  @doc """
  Fetches the `t:Explorer.Chain.InternalTransaction.changeset/2` params from the FEVM `trace_block` URL.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_block_internal_transactions(block_numbers, json_rpc_named_arguments) do
    id_to_params = id_to_params(block_numbers)

    with {:ok, blocks_responses} <-
           id_to_params
           |> debug_trace_block_by_number_requests()
           |> json_rpc(json_rpc_named_arguments),
         :ok <- Geth.check_errors_exist(blocks_responses, id_to_params) do
      transactions_params = to_transactions_params(blocks_responses, id_to_params)

      debug_trace_transaction_responses_to_internal_transactions_params(transactions_params)
    end
  end

  @doc """
  Fetches the raw traces from the FEVM trace URL.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_transaction_raw_traces(%{hash: transaction_hash, block_number: block_number}, json_rpc_named_arguments) do
    request = debug_trace_block_by_number_request({0, block_number})
    transaction_hash_string = to_string(transaction_hash)

    case json_rpc(request, json_rpc_named_arguments) do
      {:ok, response} ->
        {:ok, Enum.filter(response, &(&1["transactionHash"] == transaction_hash_string))}

      {:error, error} ->
        Logger.error(inspect(error))
        {:error, error}
    end
  end

  defp to_transactions_params(blocks_responses, id_to_params) do
    Enum.reduce(blocks_responses, [], fn %{id: id, result: transaction_result}, blocks_acc ->
      extract_transactions_params(Map.fetch!(id_to_params, id), transaction_result) ++ blocks_acc
    end)
  end

  defp extract_transactions_params(block_number, transaction_result) do
    transaction_result
    |> Enum.reduce(
      {[], 0},
      # counter is the index of the internal transaction in transaction
      fn %{"transactionHash" => transaction_hash, "transactionPosition" => transaction_index} = calls_result,
         {transaction_acc, counter} ->
        last_transaction_response_from_accumulator = List.first(transaction_acc)

        next_counter =
          with {:empty_accumulator, false} <- {:empty_accumulator, is_nil(last_transaction_response_from_accumulator)},
               true <- transaction_hash !== last_transaction_response_from_accumulator["transactionHash"] do
            0
          else
            {:empty_accumulator, true} ->
              0

            _ ->
              counter + 1
          end

        {
          [
            Map.merge(
              %{
                "blockNumber" => block_number,
                "transactionHash" => transaction_hash,
                "transactionIndex" => transaction_index,
                "index" => next_counter
              },
              calls_result
            )
            | transaction_acc
          ],
          next_counter
        }
      end
    )
    |> elem(0)
  end

  @doc """
  Fetches the pending transactions from the FEVM node.
  """
  @impl EthereumJSONRPC.Variant
  def fetch_pending_transactions(_json_rpc_named_arguments), do: :ignore

  defp debug_trace_block_by_number_requests(id_to_params) do
    Enum.map(id_to_params, &debug_trace_block_by_number_request/1)
  end

  defp debug_trace_block_by_number_request({id, block_number}) do
    request(%{
      id: id,
      method: "trace_block",
      params: [integer_to_quantity(block_number)]
    })
  end

  defp debug_trace_transaction_responses_to_internal_transactions_params(responses)
       when is_list(responses) do
    responses
    |> Enum.map(&debug_trace_transaction_response_to_internal_transactions_params(&1))
    |> Geth.reduce_internal_transactions_params()
  end

  defp debug_trace_transaction_response_to_internal_transactions_params(call) do
    internal_transaction_params =
      call
      |> parse_trace_block_call()
      |> Call.to_internal_transaction_params()

    {:ok, internal_transaction_params}
  end

  defp parse_trace_block_call(%{"Type" => type} = call) do
    sanitized_call =
      call
      |> Map.put("type", type)
      |> Map.drop(["Type"])

    parse_trace_block_call(sanitized_call)
  end

  defp parse_trace_block_call(
         %{"type" => upcase_type, "action" => %{"from" => from} = action, "result" => result} = call
       ) do
    type = String.downcase(upcase_type)

    %{
      "type" => if(type in ~w(call callcode delegatecall staticcall), do: "call", else: type),
      "callType" => type,
      "from" => from,
      "to" => Map.get(action, "to", "0x"),
      "createdContractAddressHash" => Map.get(result, "address", "0x"),
      "value" => Map.get(action, "value", "0x0"),
      "gas" => Map.get(action, "gas", "0x0"),
      "gasUsed" => Map.get(result, "gasUsed", "0x0"),
      "input" => Map.get(action, "input", "0x"),
      "init" => Map.get(action, "init", "0x"),
      "createdContractCode" => Map.get(result, "code", "0x"),
      "traceAddress" => Map.get(call, "traceAddress", []),
      "blockNumber" => Map.get(call, "blockNumber"),
      "index" => Map.get(call, "index"),
      "transactionIndex" => Map.get(call, "transactionIndex"),
      "transactionHash" => Map.get(call, "transactionHash"),
      # : check, that error is returned in the root of the call
      "error" => call["error"]
    }
    |> case do
      %{"error" => nil} = ok_call ->
        ok_call
        |> Map.delete("error")
        |> Map.put("output", Map.get(result, "output", "0x"))

      error_call ->
        error_call
    end
  end
end
